﻿<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<%@ taglib uri="http://www.shengruan.org/tags" prefix ="f"%> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link href="../style.css" rel="stylesheet" type="text/css">
<link href="<c:url value='/admin/assets/style/jqueryform.css'/>" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<c:url value='/admin/assets/js/util.js'/>"></script>
<script type="text/javascript" src="<c:url value='/assets/js/My97DatePicker/WdatePicker.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery-validate/lib/jquery.metadata.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery-validate/jquery.validate.js'/>"></script>
<script type="text/javascript" language="javascript">

/**
upload1:				{<c:if test="${null == requestScope.product}">required: true,</c:if>	accept: 'gif|jpeg|jpg|png|bmp'},
			upload2:				{<c:if test="${null == requestScope.product}">required: true,</c:if>	accept: 'gif|jpeg|jpg|png|bmp'},
			upload3:				{<c:if test="${null == requestScope.product}">required: true,</c:if>	accept: 'gif|jpeg|jpg|png|bmp'},
			upload4:				{<c:if test="${null == requestScope.product}">required: true,</c:if>	accept: 'gif|jpeg|jpg|png|bmp'},
			upload:				 	{<c:if test="${null == requestScope.product}">required: true,</c:if>    accept: 'gif|jpeg|jpg|png|bmp'}
**/
// <![CDATA[
$(document).ready(function() {

	var validator = $("#productForm").validate({
		rules: {
			name: 	        		{required: true },
			classId:         		{required: true },
			dimension: 			{required: true },
			//priceCap: 				{required: true,	number: true},
			//effectiveAuctionTime:	{required: true},
			//auctionBeginTime:		{required: true},
			//smallPic:				{<c:if test="${null == requestScope.product}">required: true,</c:if> accept: 'gif|jpeg|jpg|png|bmp'},
			upload1:				{<c:if test="${null == requestScope.product}">required: true,</c:if>  accept: 'gif|jpeg|jpg|png|bmp'},
			upload2:				{accept: 'gif|jpeg|jpg|png|bmp'},
			upload3:				{accept: 'gif|jpeg|jpg|png|bmp'},
			upload4:				{accept: 'gif|jpeg|jpg|png|bmp'},
			upload:				 	{accept: 'gif|jpeg|jpg|png|bmp'}
		},
		messages: {
					name: { 
						required:"请输入商品名称. "
					},
					classId: {
						required:"请输入商品名分类. "
					},
					dimension: {
						required: "请输入商品尺寸. "
					},
					//priceCap: {
						//required: 	"请输入封顶价格. ",
						//number: 	"封顶价格必须是数字."
					//},
					//effectiveAuctionTime:{
						//required: "请输入本轮有效竞拍时间. "
					//},
					//auctionBeginTime:{
						//required: "请输入开始竞拍时间."
					//},
					//smallPic:{
						//required: "请输入商品缩略图片.",
						//accept: "请输入拥有合法后缀名的字符串"
					//},
					upload1:{
						<c:if test="${null == requestScope.product}">required: "请输入商品图片1.",</c:if>
						accept: "请输入拥有合法后缀名的字符串"
					},
					upload2:{
						//<c:if test="${null == requestScope.product}">required: "请输入商品图片2.",</c:if>
						accept: "请输入拥有合法后缀名的字符串"
					},
					upload3:{
						//<c:if test="${null == requestScope.product}">required: "请输入商品图片3.",</c:if>
						accept: "请输入拥有合法后缀名的字符串"
					},
					upload4:{
						//<c:if test="${null == requestScope.product}">required: "请输入商品图片4.",</c:if>
						accept: "请输入拥有合法后缀名的字符串"
					},
					upload: {
						//<c:if test="${null == requestScope.product}">required: "请选择上传的图片文件. ",</c:if>
						accept: "请输入拥有合法后缀名的字符串"
					}
		} 
	});




<c:if test="${not empty requestScope.message}">
$("#infoSpan").html("<img src='<c:url value='/admin/assets/images/flag.gif'/>'><font color='#C00000'><c:out value='${requestScope.message}' escapeXml='false'/></font>");
</c:if>


<c:if test="${null != requestScope.product}">
$("#productForm").attr('action',"<c:url value='/admin/product/product-edit.ac'/>");
var auctionTactics = "${requestScope.product.auctionTactics}";
if(auctionTactics=="0")
{
	document.getElementById("auctionTacticsOne").checked = true;
	document.getElementById("auctionTacticsTwo").checked = false;
}
else
{
	document.getElementById("auctionTacticsOne").checked = false;
	document.getElementById("auctionTacticsTwo").checked = true;
}

var phoneCardIf = "${requestScope.product.phoneCardIf}";
if(phoneCardIf=="0")
{
	document.getElementById("phoneCardIfOne").checked = true;
	document.getElementById("phoneCardIfTwo").checked = false;
}
else
{
	document.getElementById("phoneCardIfOne").checked = false;
	document.getElementById("phoneCardIfTwo").checked = true;
}


</c:if>




});
// ]]>
</script>
</head>
<body class="main">
<form method="post" name="productForm" id="productForm" action="<c:url value='/admin/product/product-add.ac'/>" enctype="multipart/form-data">
<input type="hidden" id="id" name="id" value="${requestScope.product.id}"/>
<input type="hidden" id="status" name="status" value="${requestScope.status}"/>
<table class="container" cellpadding="0" cellspacing="0">
<tr><td>
<table class="dialog" align="center" cellpadding="0" cellspacing="0" width="929">
<tr><td>
<table class="header" cellpadding="0" cellspacing="0">
<tr>
<td>添加商品</td>
</tr>
</table>
</td></tr>
<tr>
  <td class="body">
<table class="body" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="2" align="center" id="errorTd">&nbsp;<span id="infoSpan" class="infoSpan">&nbsp;</span></td>
  </tr>
  <tr>
  <td width="25%" align="right"><strong>商品名称：</strong></td>
  <td width="75%"><input type="text" name="name" id="name" size="80" maxlength="100" value="${requestScope.product.name}">
  &nbsp;&nbsp;
  </td></tr>
<tr>
  <td align="right"><strong>商品分类：</strong></td>
  <td><select name="classId" id="classId" style="width:200px">
  	<c:forEach var="productClass" items="${requestScope.productClassList}">
         <c:choose>
             <c:when test="${productClass.id == requestScope.product.classId}">
               <option value="${productClass.id}" selected>${productClass.name}</option>
              </c:when> 
           <c:otherwise>
              <option value="${productClass.id}">${productClass.name}</option>
           </c:otherwise>
         </c:choose>
    </c:forEach>
  </select> 
  
  
  
      
  
  
  </td></tr>
<tr>
  <td align="right"><strong>尺寸：</strong></td>
  <td><input type="text" name="dimension" id="dimension" size="31" maxlength="31" value="${requestScope.product.dimension}" >  
  </td></tr>
<tr>
  <td align="right"><strong>规格：</strong></td>
  <td><input type="text" name="specification" id="specification" size="31" maxlength="31" value="${requestScope.product.specification}" >  
  </td></tr>
<tr>
  <td align="right"><strong>材质：</strong></td>
  <td><input type="text" name="material" id="material" size="31" maxlength="31" value="${requestScope.product.material}" >  
  </td></tr>
<tr>
  <td align="right"><strong>市场指导价格：</strong></td>
  <td><input type="text" name="price" id="price" size="31" maxlength="31" value="${requestScope.product.price}" onKeyUp="value=value.replace(/[^0-9 | . | -]/g,'')">  
  </td></tr>
<tr>
  <td align="right"><strong>全球限量：</strong></td>
  <td><input type="text" name="globalLimited" id="globalLimited" size="31" value="${requestScope.product.globalLimited}" onKeyUp="value=value.replace(/[^0-9 | . | -]/g,'')">  
  </td></tr>
  <tr>
  <td align="right"><strong></strong></td>
  <td align="left">
    <div align="left" style="padding-left:7px">
		<ul class="arialyellow">
		<li>默认不填为無限量.</li>
		</ul>
    </div>
    </td></tr>
<tr style="display:none">
  <td align="right"><strong>本轮有效竞拍时间：</strong></td>
  <td>
    <input type="text" name="effectiveAuctionTime" id="effectiveAuctionTime" value="90" style="width:200px" readonly> 秒
    </td></tr>
<tr style="display:none">
  <td align="right"><strong>开始竞拍时间：</strong></td>
  <td>
    <input type="text" name="auctionBeginTime" id="auctionBeginTime" value="${f:format(requestScope.product.auctionBeginTime)}" class="Wdate" onFocus="WdatePicker({lang:'zh',isShowClear:true,readOnly:true,minDate:'%y-%M-%d %H:{%m+1}:%s',dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:200px">
    </td></tr>
    
    <tr style="display:none">
  <td align="right"><strong>商品缩略图：</strong></td>
  <td>
    <input id="smallPic" name="smallPic" type="file" style="height:25px;width:300px" contenteditable="false" />
    </td></tr>
<tr>
  <td align="right"><strong>商品图片1：</strong></td>
  <td>
    <input id="upload1" name="upload1" type="file" style="height:25px;width:300px" contenteditable="false" />
    </td></tr>
<tr>
<tr>
  <td align="right"><strong>商品图片2：</strong></td>
  <td>
    <input id="upload2" name="upload2" type="file" style="height:25px;width:300px" contenteditable="false" />
    </td></tr>
<tr>
<tr>
  <td align="right"><strong>商品图片3：</strong></td>
  <td>
    <input id="upload3" name="upload3" type="file" style="height:25px;width:300px" contenteditable="false" />
    </td></tr>
<tr>
<tr>
  <td align="right"><strong>商品图片4：</strong></td>
  <td>
    <input id="upload4" name="upload4" type="file" style="height:25px;width:300px" contenteditable="false" />
    </td></tr>
<tr>
  <td align="right"><strong></strong></td>
  <td align="left">
    <div align="left" style="padding-left:7px">
		<ul class="arialyellow">
		<li>请选择[gif|jpeg|jpg|png|bmp]图片文件.</li>
        <li><label for="width">商品图片尺寸:</label><br /><span>宽 520 象素，高 454 象素。</span>.</li>
		</ul>
    </div>
    </td></tr>
<tr style="display:none">
  <td align="right"><strong>是否启用竞拍策略：</strong></td>
  <td>
    <label><input type="radio" name="auctionTactics" id="auctionTacticsOne" value="0" checked>否</label>
    &nbsp;&nbsp;
    <label><input type="radio" name="auctionTactics" id="auctionTacticsTwo" value="1">是</label>
    </td></tr>
    <tr style="display:none">
  <td align="right"><strong>是否是充值卡：</strong></td>
  <td>
    <label><input type="radio" name="phoneCardIf" id="phoneCardIfOne" value="0" checked>否</label>
    &nbsp;&nbsp;
    <label><input type="radio" name="phoneCardIf" id="phoneCardIfTwo" value="1">是</label>
    </td></tr>
    
    
  <c:if test="${null != requestScope.product}">
  <tr>
  <td align="right"><strong>排序：</strong></td>
  <td><input type="text" name="sort" id="sort" size="4" maxlength="4" value="${requestScope.product.sort}" onKeyUp="value=value.replace(/[^0-9]/g,'')"></td>
  </tr>
  </c:if>
    
  <tr>
  <td align="right"><strong>描述信息：</strong></td>
  <td>
  <!--<textarea id="content" name="content" style="width:99%;height:100px">${requestScope.product.description}</textarea>-->
  
<FCK:editor instanceName="description" value=" ${requestScope.product.description}" toolbarSet="szl"  height="400" width="700">
	<FCK:config SkinPath="skins/office2003/" />
</FCK:editor>
  
  
  
  </td></tr>
</table>
</td></tr>
<tr><td>
<table class="footer" cellpadding="0" cellspacing="0">
<tr><td>
<input class="button" type="submit" value="确定">
&nbsp;&nbsp;<input class="button" type="button" value="返回" onClick="document.location='javascript:history.go(-1)'">
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>

</body>
</html>
